home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / tclMotif-1.4 / doc / examples / wd < prev    next >
Text File  |  1995-06-29  |  1KB  |  69 lines

  1. #! moat
  2.  
  3. #-----------------------------------------------
  4. # Start tclMotif
  5. #
  6.  
  7. xtAppInitialize -class DumpIt
  8.  
  9.  
  10. #-----------------------------------------------
  11. # Define environement
  12. #
  13.  
  14. set name [lrange $argv 0 0]
  15. set args [lrange $argv 1 100]
  16.  
  17. proc dumpit {} "
  18.     puts stderr \"Dumping window $name\"
  19.     exec xwd -name $name -frame -out $name.wd $args
  20.     exec xpr -device ps -scale 2 -portrait -psfig -plane 0 -output $name.epsf $name.wd
  21.     exec /bin/rm -f $name.wd
  22.     exit
  23. "
  24. . setValues \
  25.     -title $name \
  26.  
  27. #-----------------------------------------------
  28. # Parse target file, and filter it
  29. #
  30.  
  31. set tmpname /tmp/$name.filtered
  32. set top ""
  33.  
  34. set file [open $name.tcl "r"]
  35. set tmp  [open $tmpname "w"]
  36.  
  37. while {! [eof $file]} {
  38.  
  39.     gets $file line
  40.     set cmd [lindex $line 0]
  41.  
  42.     switch -regexp -- $cmd {
  43.         "^[.]$"
  44.             -
  45.         "xtAppInitialize"
  46.             {}
  47.         "^xm[A-Z]*"
  48.             -
  49.         default
  50.             {    puts $tmp "$line" }
  51.     }
  52. }
  53. close $tmp
  54.  
  55. #-----------------------------------------
  56. # Read and realize the filtered file
  57. #
  58.  
  59. source $tmpname
  60. exec rm $tmpname
  61.  
  62. . realizeWidget
  63. . addInput stdin r {
  64.     read stdin 1
  65.     dumpit
  66. }
  67.  
  68. . mainLoop dumpit
  69.